package com.ztx.service.param.impl;

import java.util.List;

import javax.annotation.Resource;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Repository;

import com.ztx.model.QkType;
import com.ztx.pagemodel.easyui.DataGrid;
import com.ztx.pagemodel.easyui.PageHelper;
import com.ztx.service.param.IRateService;

@Repository
public class RateService implements IRateService {

	@Resource
	private SqlSessionTemplate sqlSessionTemplate;

	@Override
	public DataGrid<QkType> datagrid(QkType params, PageHelper ph) {
		DataGrid<QkType> dg = new DataGrid<>();
		long total = sqlSessionTemplate.selectOne(QkType.class.getName()
				+ ".getQkTypeCount", params);
		List<QkType> list = sqlSessionTemplate.selectList(
				QkType.class.getName() + ".getQkType", params,
				ph.getRowBounds());
		dg.setTotal(total);
		dg.setRows(list);
		return dg;
	}

}
